home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / util / dir / managers.lha / Managers / Dir / Dir.read < prev    next >
Text File  |  1997-01-15  |  4KB  |  181 lines

  1. G4C
  2.  
  3. ; This is a full blown text reader. It's a window with a listview.
  4. ; It reads the file you tell it and shows it.
  5.  
  6.  
  7. WinBig 0 11 0 -13 "Loading..."    ; you may want to change the position
  8. WinSmall 0 -1 150 21
  9. WinType 11110001
  10.  
  11. ;------> On Loading, we open the gui's window..
  12. ;     and load the file stated in the variable "FILENAME"
  13. ;        This has been set by an other GUI, since we get called from there.
  14.  
  15. xOnLoad
  16. setscreen dir.read $lv_fmscreen
  17. setgad dir.read 2 hide      ; hide the 2nd listview
  18. guiopen Dir.read
  19. gosub Dir.read filechange
  20.  
  21.  
  22. ;-------> Upon closing, we quit so as not to use-up memory
  23.  
  24. xOnClose
  25. guiquit Dir.read
  26.  
  27. xOnQuit
  28. delvar dglv_#?
  29.  
  30.  
  31. ;------> Routine to load & show file
  32.  
  33. xRoutine filechange             ; routine to load & show file
  34. guiscreen Dir.read front
  35. SetWinTitle Dir.read "Loading...."
  36. LVChange Dir.read 1 $FILENAME
  37. SetWinTitle Dir.read '$FILENAME                                '
  38.  
  39. ;------------> the listview. - Use 'L' for scrolling the list up/down
  40.  
  41. xListview 0 0 0 0 "" dglv_line "" 20 TXT
  42. GadID  1
  43. GadKey L
  44. GadFont topaz.font 8 000     ; CHANGE THE FONT HERE!
  45.  
  46.  
  47. ; -----------> This is an other Listview which we will use as a temporary
  48. ;              storage place. Note : we hide it upon loading of the window!
  49.  
  50. xListview 0 0 0 0 "" dglv_line2 "" 20 NUM
  51. gadid 2
  52.  
  53.  
  54. ; Herebelow are our menus, which do various things to the file
  55.  
  56.  
  57. ;========================== PROJECT MENU
  58.  
  59. xMenu Project Open.. "" O        ; load a new file
  60. extract FILENAME PATH dglv_path
  61. setvar dglv_getfile ""
  62. ReqFile -1 -1 250 200 "Choose file" LOAD dglv_getfile $dglv_path
  63. if $dglv_getfile != ""
  64.    setvar FILENAME $dglv_getfile
  65.    gosub Dir.read filechange
  66. endif
  67. delvar dglv_getfile
  68. delvar dglv_path
  69.  
  70.  
  71. xMenu Project Copy.. "" C
  72. setvar dg_dest ""
  73. ReqFile -1 -1 250 150 "Copy to :" DIR dg_dest ''
  74. if $dg_dest > ""
  75.    action copy $FILENAME $dg_dest
  76.    setwintitle Dir.read 'Copied : $FILENAME                           '
  77. endif
  78. delvar dg_dest
  79.  
  80.  
  81. xMenu Project Move.. "" M
  82. setvar dg_dest ""
  83. ReqFile -1 -1 250 150 "Move to :" DIR dg_dest ''
  84. if $dg_dest > ""
  85.    action move $FILENAME $dg_dest
  86.    setwintitle Dir.read 'Moved : $FILENAME                          '
  87. endif
  88. delvar dg_dest
  89.  
  90.  
  91. xMenu Project Rename.. "" R
  92. setvar dg_dest ""
  93. ReqFile -1 -1 250 150 "Rename to :" SAVE dg_dest ''
  94. if $dg_dest > ""
  95.    rename $FILENAME $dg_dest
  96.    FILENAME = $dg_dest
  97.    setwintitle Dir.read '$FILENAME                                  '
  98. endif
  99. delvar dg_dest
  100.  
  101.  
  102. xMenu Project Delete.. "" D
  103. EZReq 'Delete file :\n$FILENAME ?' DELETE|CANCEL dg_choice
  104. if $dg_choice = 1
  105.    setwintitle Dir.read 'Deleted : $FILENAME                         '
  106.    delete $FILENAME
  107. endif
  108. delvar dg_choice
  109.  
  110.  
  111. xMenu Project BARLABEL "" ""
  112.  
  113.  
  114. xMenu Project Status "" S
  115. status
  116.  
  117. xMenu Project About "" ""
  118. ezreq 'Reading file:\n$FILENAME\n\nWith Dir.read' 'So I am..' ""
  119.  
  120.  
  121. xMenu Project Quit "" Q
  122. guiquit Dir.read
  123.  
  124.  
  125. ; ======================== EDIT MENU
  126.  
  127. xMenu Edit C:Ed '' E
  128. guiclose Dir.read
  129. run 'c:ed $FILENAME'
  130.  
  131.  
  132. xMenu Edit C:CEd '' ''    ; for CygnusEd
  133. guiclose Dir.read
  134. ifexists port rexx_ced
  135.    sendrexx rexx_ced 'open new'
  136.    sendrexx rexx_ced 'open $FILENAME'
  137.    guiscreen cedbar.gc FRONT
  138. else
  139.    guiload guis:demos/ced/cedbar.gc
  140.    sendrexx rexx_ced 'open $FILENAME'
  141. endif
  142.  
  143.  
  144. ; ========================== Action MENU
  145.  
  146.  
  147. xMenu Action Run.. "" ""    ; run it through the dir.cli GUI
  148. guiclose Dir.read
  149. setvar cl_Main '$FILENAME '
  150. guiopen dir.cli
  151. update dir.cli  10  2
  152. setgad dir.cli  1   ON
  153.  
  154.  
  155. xMenu Action Execute.. "" ""    ; also through dir.cli
  156. guiclose Dir.read
  157. setvar cl_Main 'Execute $FILENAME '
  158. guiopen dir.cli
  159. update dir.cli 10 1
  160. setgad dir.cli 1 ON
  161.  
  162. xMenu Action View "" V        ; use the viewfile routine
  163. guiclose Dir.read
  164. rtn.option = 'run >nil:'
  165. guiload  :dir.view
  166. gosub dir.view ViewFile
  167.  
  168. xMenu Action "View Hex" "" H    ; Change it here to your favourite hex reader
  169. guiclose Dir.read
  170. run '$DEF.HEX $FILENAME'
  171.  
  172.  
  173. ;=============== ON FAILING
  174.  
  175. xOnFail
  176. SetWinTitle Dir.read '**ERROR** $FILENAME                         '
  177.  
  178.  
  179.  
  180.  
  181.